package com.jv.spring.ignore.scan;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.stereotype.Component;

@Component
public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
	@Override
	public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
		//beanFactory.ignoreDependencyType(IgnoreDept.class);
		beanFactory.ignoreDependencyInterface(MyIgnoreInterface.class);
		((GenericBeanDefinition)beanFactory.getBeanDefinition("ignoreUserV1")).setAutowireMode(AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE);
	}
}
